package ar.edu.sovietrussia.customcomponents.bookviews;

import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;

import dtos.BookInfoDTO;

/**
 */
public class BookActionsPanel extends Panel {

    private static final long serialVersionUID = 1L;

    private BookInfoDTO model;

    public BookActionsPanel(final String id, final BookInfoDTO bookModel) {
        super(id);
        this.model = bookModel;
        this.addLinks();
    }

    private void addLinks() {
        this.addInfoLink("infoLink");

    }

    private void addInfoLink(final String id) {
        Link<?> infoLink = new Link<Object>(id) {
            private static final long serialVersionUID = 1L;

            @Override
            public void onClick() {
                BookInfoDTO book = BookActionsPanel.this.getModel();
                BookActionsPanel.this.onInfoLinkClicked(book);
            }
        };
        this.add(infoLink);
    }

    protected void onInfoLinkClicked(final BookInfoDTO book) {
        // redefinir
    }

    protected BookInfoDTO getModel() {
        return this.model;
    }

}
